<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <canvas width="500" height="500px">
      
    </canvas>
    <script>
        let canvas=document.querySelector("canvas")
        let ctx=canvas.getContext("2d")
        ctx.moveTo(300,300)
        ctx.lineTo(400,400)
        ctx.lineTo(200,400)
        ctx.lineTo(300,300)
        ctx.strokeStyle="red"
        ctx.fillStyle="red"
        ctx.fill()
        ctx.stroke()

    </script>
</body>
</html>